package mk.com.ldm.corepoint.administration.shared;

import java.io.Serializable;
import java.util.ArrayList;


@SuppressWarnings("serial")
public class DataBaseObject implements Serializable{
	private String dbName = "";
	private boolean needsSingleQuotes = false;
	private String value = "";
	private boolean conditions = false;
	private String conditionValue = "";
	public ArrayList<Foreign> foreign = new ArrayList<Foreign>();
	
	public DataBaseObject(){}
	
	/**
	 * Constructor best used for select queries
	 * 
	 * @param dbName
	 * @param needsSingleQuotes
	 * @param conditions
	 * @param conditionValue
	 * @param foreign
	 */
	public DataBaseObject(String dbName, boolean needsSingleQuotes, boolean conditions, String conditionValue, ArrayList<Foreign> foreign){
		this.dbName = dbName;
		this.needsSingleQuotes = needsSingleQuotes;
		this.conditions = conditions;
		this.conditionValue = conditionValue;
		this.foreign = foreign;
	}
	
	/**
	 * Constructor best used for simple selects without joins
	 * 
	 * @param dbName
	 * @param needsSingleQuotes
	 * @param conditions
	 * @param conditionValue
	 */
	public DataBaseObject(String dbName, boolean needsSingleQuotes, boolean conditions, String conditionValue){
		this.dbName = dbName;
		this.needsSingleQuotes = needsSingleQuotes;
		this.conditions = conditions;
		this.conditionValue = conditionValue;
	}
	
	/**
	 * Constructor best used for very simple selects without any conditions
	 * 
	 * @param dbName
	 * @param needsSingleQuotes
	 */
	public DataBaseObject(String dbName, boolean needsSingleQuotes){
		this.dbName = dbName;
		this.needsSingleQuotes = needsSingleQuotes;
	}
	
	/**
	 * Constructor best used for join selects without any conditions
	 * 
	 * @param dbName
	 * @param needsSingleQuotes
	 * @param foreign
	 */
	public DataBaseObject(String dbName, boolean needsSingleQuotes, ArrayList<Foreign> foreign){
		this.dbName = dbName;
		this.needsSingleQuotes = needsSingleQuotes;
		this.foreign = foreign;
	}
	
	/**
	 * Constructor best used for insert queries
	 * 
	 * @param dbName
	 * @param needsSingleQuotes
	 * @param value
	 */
	public DataBaseObject(String dbName, boolean needsSingleQuotes, String value){
		this.dbName = dbName;
		this.needsSingleQuotes = needsSingleQuotes;
		this.value = value;
	}
	
	/**
	 * Constructor best used for update queries
	 * 
	 * @param dbName
	 * @param needsSingleQuotes
	 * @param value
	 * @param conditions
	 * @param conditionValue
	 */
	public DataBaseObject(String dbName, boolean needsSingleQuotes, String value, boolean conditions, String conditionValue) {
		this.dbName = dbName;
		this.needsSingleQuotes = needsSingleQuotes;
		this.value = value;
		this.conditions = conditions;
		this.conditionValue = conditionValue;
	}
	
	/**
	 * General constructor containing all parameters of the class
	 * 
	 * @param dbName
	 * @param needsSingleQuotes
	 * @param value
	 * @param conditions
	 * @param conditionValue
	 * @param foreign
	 */
	public DataBaseObject(String dbName, boolean needsSingleQuotes, String value, boolean conditions,
			String conditionValue, ArrayList<Foreign> foreign) {
		super();
		this.dbName = dbName;
		this.needsSingleQuotes = needsSingleQuotes;
		this.value = value;
		this.conditions = conditions;
		this.conditionValue = conditionValue;
		this.foreign = foreign;
	}

	public String getDbName() {
		return dbName;
	}
	
	public void setDbName(String dbName) {
		this.dbName = dbName;
	}
	
	public boolean getNeedsSingleQuotes() {
		return needsSingleQuotes;
	}

	public void setNeedsSingleQuotes(boolean needsSingleQuotes) {
		this.needsSingleQuotes = needsSingleQuotes;
	}

	public String getValue() {
		return value;
	}
	
	public void setValue(String value) {
		this.value = value;
	}

	public boolean isConditions() {
		return conditions;
	}

	public void setConditions(boolean conditions) {
		this.conditions = conditions;
	}

	public String getConditionValue() {
		return conditionValue;
	}

	public void setConditionValue(String conditionValue) {
		this.conditionValue = conditionValue;
	}
	
}
